﻿using Jizsoft.JFrame.Common;
using Jizsoft.JFrame.Identity.Domain.Strategies;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jizsoft.JFrame.Identity.Domain.Services
{
    public class QueryService
    {
        public SingleResult<Entities.User> QueryUser(string account)
        {
            using (JFDbContext dbContext = new JFDbContext())
            {
                Entities.User user = dbContext.Set<Entities.User>().SingleOrDefault(p => p.Account == account);
                if (user == null)
                {
                    // 账号不存在
                    return new SingleResult<Entities.User>(1, null);
                }
                return new SingleResult<Entities.User>(user);
            }
        }
    }
}
